<template>
    <div class="pages">
        <van-sticky>
            <div class="header">
                <div class="fls" @click="$router.back(-1)">
                    <img src="../../../static/images/icon-back.png" alt="">
                </div>
                <div class="centern">解除关系</div>
                <div class="fls"></div>
            </div>
        </van-sticky>
        <div class="tensyte">
            <div class="titleinhead">
                <div class="name">姓名</div>
                <div class="fr">{{tbdetail.name}}</div>
            </div>
            <div class="titleinhead">
                <div class="name">所属团队</div>
                <div class="fr">{{tbdetail.agencyTeam.name}}</div>
            </div>
            <div class="titleinhead">
                <div class="name">商户数量</div>
                <div class="fr">{{tbdetail.totalMerchant}}</div>
            </div>
        </div>
        <div class="niceckead">
            <!-- <div class="isok">提现</div> -->
            <van-button type="primary"  color="#3288FF" @click="release_relationship()"  block>解除关系</van-button>
        </div>
    </div>
</template>

<script>
import Vue from 'vue'
import { Dialog } from 'vant';
import { Notify } from 'vant';
import api from '../../api/managemenTteam'
Vue.prototype.$api = api
export default {
    beforeCreate () {
        document.querySelector('body').setAttribute('style', 'background:#f5f5f5')
    },
    data(){
        return{
            tbdetail:JSON.parse(this.$route.query.tbdetail),
        }
    },
    mounted(){
        console.log(this.tbdetail);
    },
    methods:{
        release_relationship(){
            Dialog.confirm({
            title: '注意',
            message: '解除关系后，此用户下的商户也会与其解除关系，请到【商户查询-商户划拨】页面重新划拨商户。',
            })
            .then(() => {
                console.log(this.tbdetail.id)
                // on confirm
                let data = {
                    memberId:this.tbdetail.id
                }
                this.$api.membersmemberId(this.tbdetail.id).then((res)=>{
                    console.log(res);
                    if(res.status == '0000'){
                        Notify({ type: 'success', message: '设置成功' });
                        setTimeout(()=>{
                            // this.$router.push({ name: "teamManagement" });
                            this.$router.go(-2)
                        },1000)
                    }else{
                        Notify({ type: 'warning', message: res.describe });
                    }
                })
            })
            .catch(() => {
                // on cancel
            })
        }
    }
}
</script>

<style scoped>
    .pages{
        width: 100%;
    }
    .header{
        width: 100%;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        box-sizing: border-box;
        background: #3288FF;
    }
    .header>.fls{
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .header>.fls>img{
        width: 100%;
        height: 100%;
    }
    .centern{
        color: #FFFFFF;
        font-family: OPPOSans;
        font-weight: medium;
        font-size: 17px;
        letter-spacing: 0px;
    }

    .tensyte{
        width: 100%;
        padding: 0 16px;
        box-sizing: border-box;
        background: #fff;
    }
    .titleinhead{
        width: 100%;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #f2f2f2;
        background: #fff;
    }
    .titleinhead>.name{
        color: #828282;
        font-family: OPPOSans;
        font-weight: regular;
        font-size: 16px;
        letter-spacing: 0px;
    }
    .titleinhead>.fr{
        color: #333333;
        font-family: OPPOSans;
        font-weight: regular;
        font-size: 16px;
        letter-spacing: 0px;
    }

    .namettues{
        width: 100%;
        color: #333333;
        font-family: OPPOSans;
        font-weight: medium;
        font-size: 16px;
        letter-spacing: 0px;
        margin-top: 25px;
        margin-bottom: 16px;
        padding: 0 16px;
        box-sizing: border-box;
    }
    .niceckead{
        width: 100%;
        margin-top: 40px;
        padding: 0 16px;
        box-sizing: border-box;
    }
    .isok{
        width: 100%;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        background: #3288FF;
        color: #FFFFFF;
        font-family: OPPOSans;
        font-weight: medium;
        font-size: 16px;
        letter-spacing: 0px;
    }
</style>